﻿using Messhall.Framework.Repository.Repositorys;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Messhall.Repository.Permission.EntityTypeConfigurations;

public class PermissionCodeEntityConfiguration: EntityTypeConfigurationBase<
    Messhall.Domain.Permission.BusinessObjects.PermissionCodeEntity>
{
    public override void Configure(
        EntityTypeBuilder<Messhall.Domain.Permission.BusinessObjects.PermissionCodeEntity> builder)
    {
        builder.ToTable("permissionscode");
        builder.Property(c => c.Name).HasMaxLength(200).IsRequired();
        builder.Property(c => c.Code).HasMaxLength(20).IsRequired();
        builder.Property(c => c.PermissionKeyId).IsRequired();
        //builder.HasOne(c => c.Permission).WithMany(c => c.PermissionCodes).HasForeignKey(c => c.PermissionKeyId);

        base.Configure(builder);
    }
}